Skip to content

feat(debugger): handle terminal covenant transitions with non-covenant outputs#114

Open
atl4so wants to merge 1 commit intokaspanet:covpp-reset2from
atl4so:feat/terminal-covenant-non-covenant-outputs
Open

feat(debugger): handle terminal covenant transitions with non-covenant outputs#114
atl4so wants to merge 1 commit intokaspanet:covpp-reset2from
atl4so:feat/terminal-covenant-non-covenant-outputs

Conversation

@atl4so
Copy link
Copy Markdown

@atl4so atl4so commented Apr 28, 2026

Summary

The synthesized output state collection in debugger/cli/src/main.rs included
outputs without covenant binding, e.g. plain P2PK outputs. For terminal
covenant transitions following the singleton lowering pattern, this caused
next_states to have synthesized non-zero length, breaking
require(next_states.length == 0) at script execution.

This patch filters synthesized output states by output_covenant_id.is_some(),
ensuring only covenant-bound outputs contribute to the synthesized next_states
array passed to the user policy function.

Motivation

Singleton covenant patterns commonly use terminal transitions where the user
policy function returns an empty State[] - releasing locked funds to a P2PK
recipient with no continuing covenant state.

Without this fix, JSON-driven test fixtures for these patterns produce script
execution failures at the length check, even though the fixture correctly
describes a terminal transition with no covenant outputs. The failure
originates earlier in CLI output state synthesis but surfaces at the
length assertion.

Reference: silverscript-lang/tests/covenant_declaration_ast_fixtures/lowers_singleton_sugar_transition_termination_allowed_two_field_state.sil

Testing

  • cargo test -p cli-debugger

Added a regression test covering a singleton terminal transition with a plain
P2PK output: the JSON fixture executes the release path and reaches the
terminal length check correctly with next_states.length == 0.

27/27 CLI tests pass (was 26, +1 new regression test).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant